package com.forcht.ioc.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * Created by forcht on 2018/4/20.
 */
public class MyProxy implements InvocationHandler {

    Subject subject;

    public MyProxy(Subject subject) {
        this.subject = subject;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("方法执行前");
        method.invoke(subject,args);
        System.out.println("方法执行后");
        return null;
    }
}
